from pyecharts import options as opts
from pyecharts.charts import Map
from pyecharts.faker import Faker  # 模拟数据的
from pyecharts.options import VisualMapOpts

data = [
    ["北京市", 500],
    ["广东省", 30],
    ["四川省", 3000],
]

c = (
    Map()
    .add("流感", data, "china")
    .set_global_opts(
        title_opts=opts.TitleOpts(title="各省份疫情情况"),
        visualmap_opts=VisualMapOpts(
            is_show=True,
            is_piecewise=True,
            pieces=[
                {"min": 1, "max": 9, "label": "1-9人", "color": "#CCFFFF"},
                {"min": 10, "max": 199, "label": "10-199人", "color": "#0000FF"},
                {"min": 200, "max": 299, "label": "200-299人", "color": "#D9D919"},
                {"min": 300, "max": 399, "label": "300-399人", "color": "#4F4F2F"},
                {"min": 400, "max": 499, "label": "400-4999人", "color": "#8E236B"},
            ]
        )
                     )
    .render("map_base.html")
)
